#!/bin/bash

cat >/etc/apt/sources.list <<EOF
deb http://mirrors.bfsu.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb http://mirrors.bfsu.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb http://mirrors.bfsu.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb http://mirrors.bfsu.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
EOF
apt update
apt install sudo
/sbin/usermod -aG sudo jacky

sudo sed -i -r 's/GRUB_TIMEOUT=[0-9]*$/GRUB_TIMEOUT=1/' /etc/default/grub
sudo update-grub

sudo apt install -y python3 python3-venv fzf zoxide fd-find ripgrep make bat g++ git curl git-lfs gdu tmux xz-utils luarocks
sudo ln -s /usr/bin/batcat /usr/local/bin/bat
npm config set registry https://registry.npmmirror.com

/bin/bash -c "$(curl -fsSL https://gitee.com/hevey88/install_script/raw/main/install_git.sh)"
/bin/bash -c "$(curl -fsSL https://gitee.com/hevey88/brew/raw/main/ohmyzsh_install.sh)"

# lazygit
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')
curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_arm64.tar.gz"
tar xf lazygit.tar.gz lazygit
sudo install lazygit /usr/local/bin

# starship
curl -sS https://starship.rs/install.sh | sh

# joshuto
mkdir ~/.local/bin
bash <(curl -s https://raw.githubusercontent.com/kamiyaa/joshuto/master/utils/install.sh)
/bin/bash -c "$(curl -fsSL https://gitee.com/hevey88/install_script/raw/main/install_joshuto.sh)"

/bin/bash -c "$(curl -fsSL https://gitee.com/hevey88/install_script/raw/main/nvim_config.sh)"
